﻿Imports System.Data.OleDb
Public Class foodlovers
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdsearch.Click
        'If Not IsPostBack Then

        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim nfl As String = txtnfl.Text
        Dim SqlString As String = "select * from profile where cookname=nfl"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        oleDbConn.Open()

        If SqlString = "" Then
            MsgBox("No result found")

            End If
        If nfl = "" Then
            MsgBox("Hello you have not entered any value!")

        End If
        
        oleDbConn.Close()
        oleDbConn.Dispose()
        If SqlString <> "" And nfl <> "" Then
            Response.Redirect("~/foodloversearch.aspx?cookname=" & nfl)
        End If

    End Sub
End Class